
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.StringTokenizer;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author ALICIA
 */
public class readClassSerie {

    private Vector<Double> serie;
    private Vector<Double> serief;
    public Vector<Double> getSerie() {
        return serie;
    }

    public Vector<Double> getSerief() {
        return serief;
    }

    public void setSerie(Vector<Double> serie) {
        this.serie = serie;
    }

    public readClassSerie() {

        serie = new Vector();
        serief = new Vector();
    }


    public void readToVect(String namefile) throws FileNotFoundException, IOException
    {

        File arch= new File(namefile);
        FileReader fr= new FileReader(arch);
        BufferedReader br = new BufferedReader(fr);
        String line;
        while((line=br.readLine())!=null)
        {
            System.out.println(line);

            serie.add(Double.parseDouble(line));
        }
       
    }
    public void readToVectFaltante(String namefile) throws FileNotFoundException, IOException
    {
        
         File arch= new File(namefile);
        FileReader fr= new FileReader(arch);
        BufferedReader br = new BufferedReader(fr);
        String line;
        
        line=br.readLine();
        StringTokenizer tokens = new StringTokenizer(line);
        while(tokens.hasMoreTokens()){
            String dt=tokens.nextToken();
            if(dt.equals("NaN")){serief.add(null);}
            else{serief.add(Double.parseDouble(dt));
            }
        //System.out.println(tokens.nextToken());
        }
    }

   

    /**
     * @param args the command line arguments
     */
   /* public static void main(String[] args) {
        // TODO code application logic here

        readClassSerie pru= new readClassSerie();
        readClassSerie pruf= new readClassSerie();
        try {
                pru.readToVect("C:/Users/ALICIA/Favorites/Documents/NetBeansProjects/JavaApplication1/src/DataTest/2003/a.txt");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(readClassSerie.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(readClassSerie.class.getName()).log(Level.SEVERE, null, ex);
            }
    System.out.println(pru.getSerie().size());
        try {
            pruf.readToVectFaltante("C:/Users/ALICIA/Favorites/Documents/NetBeansProjects/JavaApplication1/src/DataTest/2003/af.txt");
        } catch (FileNotFoundException ex) {
            Logger.getLogger(readClassSerie.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(readClassSerie.class.getName()).log(Level.SEVERE, null, ex);
        }
     System.out.println(pruf.getSerief().size());
    }*/

    
}
